<template>
    <div class="main-box" v-if="isRouterAlive">
        <div class="box-title">

            <div class="title-text" @click="ii">

                <div class="text">用户名</div>
                <div class="text liuyan">留言</div>
                <!-- <div class="text"></div>
                <div class="text"></div> -->
                <div class="content-bt"></div>
            </div>
        </div>
        <div class="box-content" v-for="item in msglist" :key="item.id">
            <div class="content-msg" >
                <div style="display:flex ;">
                    <div class="text">{{ item.username }}</div>
                    <div class="liuyan">{{ item.liuyan }}</div>
                </div>
                <div class="content-bt">
                    <div class="bt" @click="dle(item.id)">删除</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import axios from 'axios'


export default {

  props: ['msglist'],

  data () {
    return {
      isRouterAlive: true,
      opbt: false,
      username: {
        list: [{}]
      }
    }
  },
  methods: {
    dle (id) {
      axios.delete('/api/liuyandle?id=' + id).then(res =>{
        console.log(res)
        // this.username.list = res.data
        // console.log(this.ruleForm)
      })
    }

  }

}

</script>

<style scoped lang="scss">
.main-box {
    // height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;

    .box-title {
        height: 30px;
        position: sticky;
        top: 0;
        background-color: #cccccc;
        .title-text{
            height: 30px;
            display: flex;
            // justify-content: space-around;
            align-items: center;

            .content-bt{
                width: 140px;
            }

        }
    }
    .text{
        width: 100px;
        text-align: center;
        .liuyan{
            width: 300px;
            float: left;
        }
    }
    .box-content {
        width: 100%;
        background-color: #ffffff;
        .content-msg{
        height: 50px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom:1px solid #cccccc ;
        }
        .content-msg:hover{
        background-color: #0099CC;
        }
        .content-bt{
            width: 140px;
            display: flex;
            .bt{
                height: 25px;
                width: 50px;
                margin: 0 10px;
                text-align: center;
                line-height: 25px;
                border-radius: 20px;
                background-color: #99CCCC;
                cursor: pointer;
            }
        }
    }


}
</style>